package com.jweb.framework.ws.soap.axiom;

import javax.xml.transform.Result;

import org.apache.axiom.om.OMException;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.springframework.ws.soap.SoapHeaderElement;
import org.springframework.xml.transform.StaxResult;
/**
 * 修改人： Thomas
 * 修改内容：新增 
 * 类说明：
 */
class AxiomSoapHeaderElement extends AxiomSoapElement implements SoapHeaderElement {
	
	public AxiomSoapHeaderElement(SOAPHeaderBlock axiomHeaderBlock , SOAPFactory axiomFactory){
		super(axiomHeaderBlock, axiomFactory);
	}
	
	public String getActorOrRole(){
		return getAxiomHeaderBlock().getRole();
	}
	
	public void setActorOrRole(String role){
		getAxiomHeaderBlock().setRole(role);
	}
	
	public boolean getMustUnderstand(){
		return getAxiomHeaderBlock().getMustUnderstand();
	}
	
	public void setMustUnderstand(boolean mustUnderstand){
		getAxiomHeaderBlock().setMustUnderstand(mustUnderstand);
	}
	
	public Result getResult(){
		try {
			return new StaxResult(new DXMLStreamWriter(getAxiomHeaderBlock(), getAxiomFactory()));
		} catch (OMException e) {
			throw new AxiomSoapHeaderException(e);
		}
	}
	
	public String getText(){
		return getAxiomHeaderBlock().getText();
	}
	
	public void setText(String content) {
		getAxiomHeaderBlock().setText(content);
	}
	
	protected SOAPHeaderBlock getAxiomHeaderBlock(){
		return (SOAPHeaderBlock) getAxiomElement();
	}
	
	

}

